﻿@model Cxuu.Models.EditArticleMark
@{
    ViewData["Title"] = await SystemConfig.GetByFieldNameAsync("SiteName");
}
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>@ViewData["Title"]</title>
    <link rel="stylesheet" href="~/lib/layui/css/layui.css">
    <link rel="stylesheet" href="~/admin/css/main.css">
    <style>
        html { zoom: 100%; width: 95%; margin: 5px auto; height: auto; }
        .cxuu-abho { color: black !important; font-size: 14px; }
            .cxuu-abho li { line-height: 30px; }
    </style>
</head>
<body>
    <div class="layui-fluid" style="margin-bottom:50px;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="cxuu-abho">
                    <ul>
                        <li style="text-align:center;">
                            <div style="color:darkblue !important;font-weight:bold;font-size:18px;" id="Title"></div>    <hr>
                        </li>
                        <li style="color:gray;text-align:center;">
                            <div>
                                填报人：<span id="Groupname"></span> - <span id="Nickname"> 经办人：<span id="Clercator"></span></span>
                                时间：<span id="InsertTime"></span>
                            </div>
                            <div><hr /></div>
                        </li>
                        <li style="color:gray;text-align:center;">
                            <div>
                                <span id="ObjectId1"></span> &nbsp;&nbsp;<span id="ObjectId2"></span>
                            </div>
                            <div><hr /></div>
                        </li>

                    </ul>
                </div>
                <div>

                    <div style="text-align:center;" id="Img">
                    </div>
                    <div id="Remark">
                        <fieldset class="layui-elem-field">
                            <legend>备注</legend>
                            <div class="layui-field-box" id="remark_content">
                            </div>
                        </fieldset>
                    </div>

                </div>

                <fieldset class="layui-elem-field" id="Attment">
                    <legend>附件下载</legend>
                    <div class="layui-field-box">
                        <script id="attments" type="text/html">
                            <h3>{{ d.title }}</h3>
                            <ul>
                            {{#  layui.each(d.list, function(index, item){ }}
                              <li>
                                <span class="layui-badge-dot layui-bg-blue"></span>
                                <span> <a href="{{ item.url }}" style="color:forestgreen; font-size:16px;" download="{{ item.filename }}"> {{ item.filename }} </a></span>
                              </li>
                            {{#  }); }}
                            {{#  if(d.list.length === 0){ }}
                              无附件
                            {{#  } }}
                            </ul>
                        </script>
                        <div id="attmentsView"></div>
                    </div>
                </fieldset>
            </div>
        </div>
    </div>
    <script src="~/lib/jquery.min.js?v=1.12.4"></script>
    <script src="~/lib/layui/layui.js"></script>
    <script src="~/lib/cxuu-main.js"></script>
    <script>
        layui.define(function () {
            var $ = layui.jquery, element = layui.element, laytpl = layui.laytpl;

            var index = parent.layer.getFrameIndex(window.name);

            let id = getUrlParam('id');
            $('#Img').hide();
            $('#Remarks').hide();
            $('#Attment').hide();
            $.getJSON("/Admin/Statement/AddOrEdit", { "id": id ,"edit":1}, function (res) {
                if (res.status == 1) {
                    var data = res.data;
                    if (data != null) {
                        $('#Title').html(data.title);
                        $('#ObjectId1').html(data.objectId1);
                        $('#ObjectId2').html(data.objectId2);
                        $('#Clercator').html(data.clercator);
                        $('#CateName').html(data.cateName);
                        $('#Groupname').html(data.groupname);
                        $('#Nickname').html(data.nickname);
                        $('#InsertTime').html(data.insertTime);

                        if (data.img != null){
                            $('#Img').show();
                            $('#Img').html('<img src="' + data.img + '" width="680">');
                        }
                        
                        if (data.remarks != null) {
                            $('#Remarks').show();
                            $('#remark_content').html(data.remarks);
                        } 
                    }

                    var att = res.attments;
                    // 附件列表模板渲染
                    if (att != null) {
                        $('#Attment').show();
                        var data = {
                            // "title": "附件列表:"
                            "list": att
                        }
                        var getTpl = attments.innerHTML
                            , view = document.getElementById('attmentsView');
                        laytpl(getTpl).render(data, function (html) {
                            view.innerHTML = html;
                        });
                    }
                } else {
                    layer.msg("数据加载失败");
                }
            });

        });

    </script>
</body>
</html>